package com.example.helloworld;

public class BoxTest<T> {

        private T t;
        public void add(T t) {
            this.t = t;
        }

        public T get() {
            return t;
        }

        public static void main(String[] args) {
            BoxTest<Integer> box = new BoxTest<Integer>();
            BoxTest<String> box2 = new BoxTest<String>();
            box.add(10);
            box2.add("Hello World");
            System.out.printf("整型值：%d\n", box.get());
            System.out.printf("字符串值：%s\n", box2.get());
        }
    }

